<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="http://unpkg.com/vue@next"></script>
</head>

<body>
    <div id="root"></div>
</body>
<script>
    let app = Vue.createApp({
        template: '<child value="aa" @change=handleChange>虚拟</child>',
        methods: {
            handleChange() {
                alert(2)
            }
        }
    })
    app.component('child', {
        template: '<div @click=handleClick>child</div>',
        mounted() {
            //原本方法获取父组件方法
            this.$emit('change')
        },
        setup(props, context) {
            const { emit } = context
            function handleClick() {
                emit('change')
            }
            return { handleClick }
        },
    })
    app.mount('#root')
</script>

</html>